import axios from 'axios'
import * as echarts from 'echarts'
import {
    reverse
} from 'lodash'

export default function (params) {
    return {
        darkMode: 'auto',
        title: {
            text: "近五年学期在校人数",
            subtext: "", //解释
            left: 20,
            textStyle: {
                fontSize: 20,
                color: "#bcdcff"
            }
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow',
                label: {
                    show: true
                }
            }
        },
        toolbox: {
            show: false,
            feature: {
                mark: {
                    show: true
                },
                dataView: {
                    show: true,
                    readOnly: false
                },
                magicType: {
                    show: true,
                    type: ['line', 'bar']
                },
                restore: {
                    show: true
                },
                saveAsImage: {
                    show: true
                }
            }
        },
        calculable: true,
        legend: {
            data: ['Growth', '本科', '专科'],
            itemGap: 10,
            // orient: 'vertical',  //垂直显示
            // y: 'center',    //延Y轴居中
            x: 'right', //居右显示
            textStyle: {
                color: '#bcdcff'
            }
        },
        grid: {
            x: 50,
            y: 50,
            x2: 50,
            y2: 50,
            top: '13%'
        },
        calculable: false,
        xAxis: [{
            type: 'category',
            data: reverse(params.list),
            axisLabel: {
                show: true,
                interval: 0,
                rotate: 0,
                textStyle: {
                    color: '#bcdcff'
                }
            }
        }],
        yAxis: [{
            type: 'value',
            name: '', //Y轴提示框
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#bcdcff'
                }
            }
        }],
        dataZoom: [{
                show: false,
                start: 0,
                end: 100
            },
            {
                type: 'inside',
                start: 0,
                end: 100
            },
            {
                show: false,
                yAxisIndex: 0,
                filterMode: 'empty',
                width: 30,
                height: 0,
                showDataShadow: false,
                left: '93%'
            }
        ],
        series: [{
                name: '本科',
                type: 'bar',
                data: reverse(params.dataChun),
                color: 'rgb(0, 250, 167)'
            },
            {
                name: '专科',
                type: 'bar',
                data: reverse(params.dataQiu),
                color: 'orange'
            }
        ]
    }
}